package com.app.car.user;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.app.car.bean.LoginBean;
import com.app.car.login.LoginActivity;
import com.app.car.R;
import com.app.car.home.HomeBaseActivity;
import com.app.car.other.PdfScanActivity;
import com.app.car.set.SetActivity;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import butterknife.BindView;
import butterknife.OnClick;
import my.ActivityTool;
import my.MySharedPreferences;


public class UserIndexActivity extends HomeBaseActivity {



    @BindView(R.id.tv_name)
    TextView textName;
    @BindView(R.id.tv_content)
    TextView textContent;
    @BindView(R.id.img_photo)
    ImageView img_photo;


    @Override
    public void initViews() {
        setContentView(R.layout.user_index_activity);
        super.initViews();
        setTitleBg(R.color.transparent);
        ((TextView) findViewById(R.id.base_title_text)).setTextColor(getResources().getColor(R.color.white));
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        MySharedPreferences mSp = new MySharedPreferences(this);
        textName.setText("");
        textContent.setText("" + mSp.getUser());
    }


    @OnClick(R.id.btn_out)
    void logout() {
        new QMUIDialog.MessageDialogBuilder(mContext).setMessage("退出当前账号？").addAction("取消", new QMUIDialogAction.ActionListener() {
            @Override
            public void onClick(QMUIDialog dialog, int index) {
                dialog.dismiss();
            }
        }).addAction(0, "立即退出", QMUIDialogAction.ACTION_PROP_NEGATIVE, new QMUIDialogAction.ActionListener() {
            @Override
            public void onClick(QMUIDialog dialog, int index) {
                dialog.dismiss();
                LoginActivity.toLoginAllClear(mContext);
            }
        }).create().show();
    }

    @OnClick(R.id.view_reset_pwd)
    void modifypwd() {
        ActivityTool.skipActivity(mContext, ModifyPwdActivity.class);
    }

    @OnClick(R.id.view_man_info)
    void toTeaMan() {
        if(!LoginBean.getInstance().canAddTeaMan()){
            showToast("权限不足！");
            return;
        }
    }

    @OnClick(R.id.view_about)
    void about() {
        ActivityTool.skipActivity(mContext, SetActivity.class);
    }

    @OnClick(R.id.view_update)
    void update() {
        showToast("开发中");
    }




    void help() {
        PdfScanActivity.toPdfScanActivity(mContext, "智能秤称重部分使用使用说明.pdf", "用户手册");
    }


    
}
